<?php 
  include "inc/conn.php";
  include "config.php";
  $tts = date("YmdHis",time());
  // $tts = date("Y-m-d H:i:s",time());
// $arr_sucess = array("code" =>"1" ,"msg"=>"签到成功" );

function json_encodeX($array) {
	if(version_compare(PHP_VERSION,'5.4.0','<')){
	  $str = json_encode($array);
	  $str = preg_replace_callback("#\\\u([0-9a-f]{4})#i",function($matchs){
	       return iconv('UCS-2BE', 'UTF-8', pack('H4', $matchs[1]));
	  },$str);
	  return $str;
	}else{
	  return json_encode($array, JSON_UNESCAPED_UNICODE);
	}
}

$stime=microtime(true); 
$time_creat = date("Y-m-d H:i:s",time());
$codes = trim($_POST['code']);
$shujus = $_POST['txt_data'];
$shuru1_ar = $_POST['input_name'];
$shuru1 = $shuru1_ar[0];
// var_dump($shuru1);

if($shujus == 1){
            	
// echo "<!-- $shuru1 == $tabvs[1] -->";
// 查询成功后，将数据存入文件，并且提示签到成功，这样能知道签到有多少人
$fp_qd_ok=fopen($file_qd_ok,"a+b");
$fp_time=fopen($file_qd_time,"a+b");
                
           
fwrite($fp_qd_ok,"$shuru1_ar[0]\t$shuru1_ar[1]\t$shuru1_ar[2]\r\n"); 
fwrite($fp_time,"{$time_creat}\r\n"); 
        
fclose($fp);
fclose($fp_time);


$arr_sucess = array("code"=>"2", "msg"=>"提交成功" , "success_msg"=>$shuru1_ar[0] ,"success_msg_repeat"=>"首次签到","user_name" =>"等待管理员审核", "user_phone"=>"等待管理员审核","user_qudao"=>$shuru1_ar[0]);
echo json_encodeX($arr_sucess);
exit;

fclose($filer); 

}

$etime=microtime(true);//获取程序执行结束的时间
$total=$etime-$stime;   //计算差值
//echo "<div>页面执行时间：{$total} 秒</div>";

?>
